package com.example.demo.service;

import com.example.common.entity.ArticleInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.demo.mapper.ArticleMapper;
import java.util.List;

@Service
public class ArticleService {

    @Autowired
    private ArticleMapper articleMapper;

    public List<ArticleInfo> getAllArtInfoByUid(Integer uid) {
        return articleMapper.getAllArtInfoByUid(uid);
    }

    public Integer delArt(Integer id, Integer uid) {
        return articleMapper.delArt(id, uid);
    }

    public ArticleInfo getArtInfoById(Integer id) {
        return articleMapper.getArtInfoById(id);
    }

    public Integer incrRCount(Integer id) {
        return articleMapper.incrRCount(id);
    }

    public Integer add(ArticleInfo articleInfo) {
        return articleMapper.add(articleInfo);
    }

    public Integer update(ArticleInfo articleInfo) {
        return articleMapper.update(articleInfo);
    }

    public List<ArticleInfo> getListByPage(Integer psize, Integer offset) {
        return articleMapper.getListByPage(psize, offset);
    }

    public Integer getArtAllCount() {
        return articleMapper.getArtAllCount();
    }

    public Integer saveArt(ArticleInfo articleInfo) {
        return articleMapper.saveArt(articleInfo);
    }

    public List<ArticleInfo> getMyDraftListByUid(Integer uid) {
        return articleMapper.getMyDraftListByUid(uid);
    }

    public Integer saveDraft(ArticleInfo articleInfo) {
        return articleMapper.saveDraft(articleInfo);
    }

    public Integer updateLikesByAid(Integer aid, Integer likes) {
        return articleMapper.updateLikesByAid(aid, likes);
    }
}
